package main

import "fmt"

func printSlice(arr []int) {
	for i := range arr {
		fmt.Printf("value:%d, cap:%d\n", i, cap(arr))
	}
}

func main() {

	fmt.Println("Slice append operate")

	var s []int // Zero value for slice is nil
	fmt.Println(s)

	for i := 0; i < 30; i++ {
		s = append(s, i)
	}

	s1 := s[2:8]

	fmt.Println("Slice make operate")
	s2 := make([]int, 10)

	fmt.Println("Slice copy operate")
	fmt.Println("s1:", s1)
	fmt.Println("s2:", s2)
	copy(s2, s1)
	fmt.Println("s2:", s2)

	fmt.Println("Slice append operate")
	s2 = append(s2, 25)
	fmt.Println("append end s2:", s2)

	fmt.Println("Slice delete operate")

	s2 = append(s2[:5], s2[6:]...)

	fmt.Println("s2 delete end:", s2)
}
